package com.etone.smartAudit.config;

import cn.hutool.core.util.StrUtil;
import com.etone.smartAudit.domain.Admin;
import com.etone.smartAudit.mapper.AdminMapper;
import com.etone.smartAudit.security.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserComment {
    @Autowired
    private AdminMapper adminMapper;

    public Admin getCurAdmin() {
        String loginAdminName = SecurityUtils.getCurrentUserLogin();
        if(StrUtil.isEmpty(loginAdminName)){
            return null;
        }
        Admin admin = adminMapper.findByAccount(loginAdminName);
        return admin;
    }
}
